﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml;
using System.Xml.Linq;
using Mono.Cecil;
using Mono.Cecil.Cil;
using Ue.Aop;

public class ModuleWeaver
{
    private IEnumerable<IWeaver> weavers;

    public ModuleWeaver()
    {
        this.weavers = new[]{
            new Ue.Aop.Methods.MethodWeaver(this)
        };
    }

    #region properties

    public XElement Config { get; set; }

    public ModuleDefinition ModuleDefinition { get; set; }
    public IAssemblyResolver AssemblyResolver { get; set; }
    public string AssemblyPath { get; set; }

    public Action<string, SequencePoint> LogWarningPoint { get; set; }
    public Action<string, SequencePoint> LogErrorPoint { get; set; }
    public Action<string> LogInfo { get; set; }
    public Action<string> LogWarning { get; set; }
    public Action<string> LogError { get; set; }

    #endregion

    public void Execute()
    {
        this.LogInfo = s => { };
        this.LogWarning = s => { };

        foreach (var item in this.weavers)
        {
            item.Execute();
        }
    }
}